{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-03-22T14:01:09.051428Z",
     "start_time": "2025-03-22T14:01:05.659240Z"
    }
   },
   "source": [
    "import copy\n",
    "import math\n",
    "\n",
    "import numpy as np\n",
    "import torch\n",
    "import torch.nn as nn\n",
    "import matplotlib.pyplot as plt\n",
    "from torch.nn import functional as F\n",
    "\n"
   ],
   "outputs": [],
   "execution_count": 1
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-02-16T09:41:27.352802Z",
     "start_time": "2025-02-16T09:41:27.341110Z"
    }
   },
   "cell_type": "code",
   "source": [
    "linear = nn.Linear(4, 2)\n",
    "a1 = torch.randn(3, 4)\n",
    "linear(a1)\n"
   ],
   "id": "e819df844492973e",
   "execution_count": 3,
   "outputs": []
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-02-16T12:33:21.575057Z",
     "start_time": "2025-02-16T12:33:21.565597Z"
    }
   },
   "cell_type": "code",
   "source": [
    "w = torch.empty(3, 5)\n",
    "w = nn.init.xavier_uniform_(w, gain=nn.init.calculate_gain('relu'))\n",
    "w"
   ],
   "id": "f995ed2f0d53361",
   "execution_count": 6,
   "outputs": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
